package com.spring1.main;

import com.spring1.bean.FirstBean;
import com.spring1.bean.SecondBean;
import com.spring1.bean.ThirdBean;
import com.spring1.factory.BeanFactory;
import com.spring1.parse.ParseXmlBean;
import org.junit.Test;

public class MainTest {
    @Test
    public void test_1() {
        BeanFactory beanFactory = ParseXmlBean.parseXmlBean("config/bean.xml");
        FirstBean firstBean = beanFactory.getBean("firstBean", FirstBean.class);
        String userInfo = firstBean.getUserInfo();
        System.out.println(userInfo);

        SecondBean secondBean = (SecondBean) beanFactory.getBean("secondBean");
        String userInfo1 = secondBean.getUserInfo();
        System.out.println(userInfo1);

        ThirdBean thirdBean = (ThirdBean) beanFactory.getBean("thirdBean");
        thirdBean.printUserInfo();
    }
}
